package cn.edu.scau.cmi.chenyipeng.Adapter;


import java.util.ArrayList;
import java.util.List;

public class UnsortedStudents {
	private ArrayList<Student> allStudents = new ArrayList<Student>();
	
	public void addStudent(Student o) {
		allStudents.add(o);
	}
	
	public ArrayList<Student> getALL(){
		return this.allStudents;
	}
	
	public List<Integer> getAllID(){
		List<Integer> ids = new ArrayList<Integer>();
		for(int i = 0; i < allStudents.size(); i++) {
			ids.add(allStudents.get(i).getId());
		}
		return ids;
	}
	
	public int search(int id) {
		int address = -1;
		for(int i = 0; i < allStudents.size(); i++) {
			if(id == allStudents.get(i).getId()) {
				address = i;
				break;
			}
		}
		return address;
	}
}
